package com.situ.day2;

public class Students {   //实体类，单独文件，不写别的（类名）
	private int id;   //属性私有，加private
	private int age;
	String name;
	String className;
	
	public  Students() {
		System.out.println("Student.students()");
		}
	
	public Students( int id,int age,String name, String className){//方法名和类名一样
		this.id = id;
		this.age = age;
		this.name = name;
		this.className = className;
	}
	public int getId(){ //           
		return id;    //
	}     //
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		if (age > 0 && age <= 120) {    //控制
			this.age = age;
		}
	}
//
//	public String getName() {
//		return name;
//	}
//
//	public void setName(String name) {
//		this.name = name;
//	}
//
//	public String getClassName() {
//		return className;
//	}
//
//	public void setClassName(String className) {
//		this.className = className;
//	}
//
	public void setId(int id){//
		this.id = id;//
	}
	
	@Override
	public String toString() {
		return "Students [id=" + id + ", age=" + age + ", name=" + name + ", className=" + className + "]";
	}

	
}
